using System.Collections.Generic;
using Abp.Runtime.Session;
using Abp.Timing.Timezone;
using Precise.DataExporting.Excel.EpPlus;
using Precise.Products.Dtos;
using Precise.Dto;
using Precise.Storage;

namespace Precise.Products.Exporting
{
    public class ProductExcelExporter : EpPlusExcelExporterBase, IProductExcelExporter
    {

        private readonly ITimeZoneConverter _timeZoneConverter;
        private readonly IAbpSession _abpSession;

        public ProductExcelExporter(
            ITimeZoneConverter timeZoneConverter,
            IAbpSession abpSession,
			ITempFileCacheManager tempFileCacheManager) :  
	base(tempFileCacheManager)
        {
            _timeZoneConverter = timeZoneConverter;
            _abpSession = abpSession;
        }

        public FileDto ExportToFile(List<GetProductForView> product)
        {
            return CreateExcelPackage(
                "Product.xlsx",
                excelPackage =>
                {
                    var sheet = excelPackage.Workbook.Worksheets.Add(L("Product"));
                    sheet.OutLineApplyStyle = true;

                    AddHeader(
                        sheet,
                        L("Name"),
                        L("Number"),
                        L("Descritpion")
                        );

                    AddObjects(
                        sheet, 2, product,
                        _ => _.Product.Name,
                        _ => _.Product.Number,
                        _ => _.Product.Descritpion
                        );

					

                });
        }
    }
}
